import React, { Component } from 'react'
import axios from 'axios';

export default class App extends Component {
    getStudentDate = ()=>{
        axios.get('/api1/students').then(
            response => console.log(response.data),
            error=> console.log(error)
        )
    }
    getCarsDate = () =>{
        axios.get('/api2/cars').then(
            response => console.log(response.data),
            error=> console.log(error)
        )
    }
    render() {
        return (
            <div>
                <button onClick={this.getCarsDate}>获取汽车数据</button>
                <button onClick={this.getStudentDate}>获取学生数据</button>
            </div>
        )
    }
}
